package metu.tespit.session.schedule;

import java.util.List;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

import metu.tespit.entity.course.Activity;
import metu.tespit.entity.course.Schedule;
import metu.tespit.session.EntityManager.ExtendedEntityHome;
import metu.tespit.session.course.CourseHome;

/**
 
 * @created May 28, 2012
 */
@Name("scheduleHome")
public class ScheduleHome extends ExtendedEntityHome<Schedule>{

	private static final long serialVersionUID = -7768656870164264708L;
	
	@In
	CourseHome courseHome;
	
	public boolean hasSubmissionActivities(){
		
		if(this.instance==null){
			this.setInstance(courseHome.getInstance().getSchedule());
		}
		
		List<Activity> acts=this.instance.getActivities();
		
		if(acts.size()==0){
			return false;	
		}
		
		for(Activity act : acts){
			if(act.getSubmissionActivity()!=null){
				return true;
			}
		}
		return false;
	}

}
